<template>
	<view class="content">
		<image @click="open" :src="url" mode="widthFix"></image>
	</view>
</template>

<script>
	import {
	    mapState,
	    mapMutations
	} from 'vuex'
	
	export default {
		computed: {
		    ...mapState(['token','SystemInfo'])
		},
		data() {
			return {
				url: ''
			}
		},
		onLoad(options) {
			if (options && options.url) {
				this.url = options.url;
			}
		},
		onShow() {
			this.getinfo()
		},
		methods: {
			...mapMutations(['getNetworkType','vuexRequest']),
			getMessage(event) {
				uni.showModal({
					content: JSON.stringify(event.detail),
					showCancel: false
				});
			},
			getinfo() {
				this.vuexRequest({
					url: '/api/addons/execute?route=agent/authorization&addon=o-s-mall-dist&access-token=' + this.token,
					method: 'POST',
					data: {},
					success: (res)  => {
						this.url = res.data.data.url
					},
					fail: (err)  => {
					},
				})
			},
			open(){
				// 预览图片
				uni.previewImage({
					current: "0",
					urls: [""+this.url+""]
				})
			}
		}
	}
</script>

<style>
	.content image{
		width: 100%;
		display: block;
	}
</style>
